package yun1.shuxue;

import java.util.Scanner;

/**
 * 对于某种进制的数，求各位数之和 sum，需要提供的条件：BB0（数字） + 进制 R
 * 
 * 10 1
 * A 10
 * 10 1 
 * 
 * @author Administrator
 *
 */

public class Sky {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		if(getSum(a,10) == getSum(a,16) && getSum(a,10) == getSum(a,12)) {
			System.out.println(a + " is a Sky Number.");
		}else {
			System.out.println(a + " is not a Sky Number.");
		}	
		
		showSkyNumber();
	}
	
	public static int getSum(int n, int r) {//先以10进制为例 2992
		//如何计算22：2992 ，2-299；299，9-29；29，9-2；2 0
		int sum = 0;
		while(n>0) {
			sum += n%r;
			n = n/r;
		}
		return sum;
	}
	
	public static void showSkyNumber() {
		for(int a=0;a<=10000;a++) {
			if(getSum(a,10) == getSum(a,16) && getSum(a,10) == getSum(a,12)) {
				System.out.println(a + " is a Sky Number.");
			}
		}
	}
	
	

}
